//Fri Jun  3 19:25:12 CDT 2011
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class LargestCircle {
public:
	int radius(vector <string>);
};

int LargestCircle::radius(vector <string> grid) {
	int M = grid.size();
	int N = grid[0].size();
	int maxr = min(M, N) / 2;
	for(int r=maxr; r>0; r--){
		for(int j=0; j<N; j++){
			for(int i=0; i<M; i++){
				if(i-r+1>=0 && i+r<M && j-r+1>=0 && j+r<N){
					bool flag = true;
					for(int x=i-r; x<= i+r && flag; x++)
						for(int y=j-r; y<=j+r && flag; y++){
							int dist1 = abs(x-i) * abs(x-i) + abs(y-j) * abs(y-j) - r*r;
							int dist2 = abs(x-i-1) * abs(x-i-1) + abs(y-j) * abs(y-j) - r*r;
							int dist3 = abs(x-i) * abs(x-i) + abs(y-j-1)*abs(y-j-1) - r*r;
							int dist4 = abs(x-i-1) * abs(x-i-1) + abs(y-j-1) * abs(y-j-1) - r*r;
							vector<int> dist;
							dist.push_back(dist1);
							dist.push_back(dist2);
							dist.push_back(dist3);
							dist.push_back(dist4);
							sort(dist.begin(), dist.end());
							if(dist[0]<0 && dist[3]>0 && grid[x][y] == '#')
								flag = false;
//							if(dist1>0 && dist2>0 && dist3>0 && dist4>0) continue;
//							if(dist1<0 && dist2<0 && dist3<0 && dist4<0) continue;
//							if(grid[x][y] == '#') flag = false;
						}
					if(flag){
						cout << "Center: " << i << "," << j << endl;
						return r;
					}
				}
			}
		}
	}
	return 0;
}

//<%:testing-code%>
//Powered by [KawigiEdit] 2.0!
